

*Set working directory
cd "/path/to/replication"

*Open file from Italian National Election Studies
	use "data/Itanes_2018_release01_panel_pre_post.dta", clear

*Prejudice
*Question asked June 2016, before referendum
*Do we have too many immigrants?
	replace img1 =. if img1==8
	gen prejudice=7 if img1==1
	replace prejudice=6 if img1==2
	replace prejudice=5 if img1==3
	replace prejudice=4 if img1==4
	replace prejudice=3 if img1==5
	replace prejudice=2 if img1==6
	replace prejudice=1 if img1==7

*Far right collocation
*Question asked after referendum
*Where do you position yourself on a scale from 1 (far-left) to 10 (far-right)?
	replace lrself=. if lrself==11|lrself==88
	gen farright_position =lrself

*Far right voting
	gen farright_voting=0
	replace farright_voting=1 if voto1==9|voto1==10
	gen lega=0
	replace lega=1 if voto1==9
	gen fi=0
	replace fi=1 if voto1==10

*Label
	label var lega "Lega (0-1)"
	label var fi "Brothers of Italy (0-1)"
	label var farright_position "Self-positioning left-right (1-7)"
	label var prejudice "Hostility against immigrants"

**Figure I.1

	binscatter2 lega prejudice, ytitle(% respondents planning to vote Lega) xtitle(by levels of hostility against immigrants arrivals) name(lega, replace)
	binscatter2 fi prejudice, ytitle(% respondents planning to vote Brohers of Italy) xtitle(by levels of hostility against immigrants arrivals) name(fi, replace)

	graph combine lega fi, ycommon
	graph export "correl_farrightvoting_itanes.pdf", replace as(pdf)

**Figure I.2

	binscatter2 farright_position prejudice, ytitle(Self-positioning on a left-right scale) xtitle(by levels of hostility against immigrants arrivals) 
	graph export "correl_farrightposition_itanes.pdf", replace as(pdf)
